-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix pyright issue #30147 #30192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix pyright issue #30147 #30192
Conversation
linter failed, please fix |
|
||
if np_type: | ||
return np.dtype(np_type) | ||
# Sostituita implementazione con next() per evitare None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments, if necessary, should be in english, please
|
||
if np_type: | ||
return np_type | ||
# Sostituita implementazione con next() per evitare None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment language, please
|
||
raise OVTypeError("Unidentified data type %s", openvino_type) | ||
|
||
|
||
def get_ndarray(data: NumericData) -> np.ndarray: | ||
"""Wrap data into a numpy ndarray.""" | ||
if isinstance(data, np.ndarray): | ||
return data # type: ignore | ||
return data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary change
return np.array(data) | ||
|
||
|
||
def get_shape(data: NumericData) -> TensorShape: | ||
"""Return a shape of NumericData.""" | ||
if isinstance(data, np.ndarray): | ||
return data.shape # type: ignore | ||
return data.shape |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary change
if isinstance(data, list): | ||
return [len(data)] # type: ignore | ||
return [len(data)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary change
Description
This PR fixes issue #30147 by resolving the Pyright errors in the
src/openvino/utils/types.py
file.Changes made
cast
import from the typing libraryas_node
function to use proper type casting withisinstance
checks instead ofissubclass(type())
as_nodes
function usingcast
for proper list typingTesting
src/openvino/utils/types.py
from the exclusions inpyproject.toml